<template>
    <el-upload list-type="picture-card" accept=".png,.jpeg,.jpg,.webp" :autoUpload="false" v-model:fileList="images" withCredentials
        :before-upload="beforeAvatarUpload" :disabled="disabled">
        <el-icon class="icon">
            <Plus />
        </el-icon>
    </el-upload>
</template>
<script setup>
    const props = defineProps({
        disabled: Boolean
    })

    const images = ref([])

    function beforeAvatarUpload(rawFile) {
        if (rawFile.size / 1024 / 1024 > 5) {
            ElMessage.error('图片大小不能超出5M')
            return false
        }
        return true
    }
</script>

<style lang='scss' scoped></style>